﻿using B.S.Warehouse.Domain;
using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Read.Api.Application.Command.WarehouseManagementCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Warehouse.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WareHouseManagementController : ControllerBase
    {
        private readonly IMediator mediator;

        public WareHouseManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 类别显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<WareHouseType>>> GetWareHouseType([FromQuery] GetWareHouseTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 仓库显示
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<WareHouse>>> GetWareHouse([FromQuery] GetWareHouseCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 库位显示
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<ApiResult<List<StorageArea>>> GetStorageArea([FromQuery] GetStorageAreaCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 仓位显示
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<ApiResult<List<StorageLocation>>> GetStorageLocation([FromQuery] GetStorageLocationCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
